<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
    <xsl:param name="DOTNET2"/>
    
    
    	<xsl:template match="Class">
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace <xsl:value-of select="//HeaderInfo/ProjectName"/>.Core.Domain.DataAccess
{

	public class <xsl:value-of select="Name"/> : DomainObject&lt;Guid&gt;
	{
		
		<![CDATA[///<summary>]]>
		/// Consider making this parameter private to limit access
		/// to the creation of these objects by direct means. 
		<![CDATA[///</summary>]]>
		public <xsl:value-of select="Name"/> ( ) { }
		
		
		#region Fields
		<xsl:for-each select="ClassAttribs/ClassAttributes[CType='single']">
		private <xsl:value-of select="Type"/><xsl:if test="Type='DateTime'">?</xsl:if> _<xsl:value-of select="Name"/>;</xsl:for-each>
		
		
		<xsl:for-each select="ClassAttribs/ClassAttributes[CType='array']">
		private Iesi.Collections.Generic.ISet&lt;<xsl:value-of select="Type"/>&gt; _<xsl:value-of select="Name"/> = 
		    new Iesi.Collections.Generic.HashedSet&lt;<xsl:value-of select="Type"/>&gt; ( );
		</xsl:for-each>
		#endregion
		
		
		
		#region Properties
		<xsl:for-each select="ClassAttribs/ClassAttributes[CType='single']">
		public virtual <xsl:value-of select="Type"/><xsl:if test="Type='DateTime'">?</xsl:if><xsl:text> </xsl:text><xsl:value-of select="PropertyName"/>
		{
			get
			{
				return _<xsl:value-of select="Name"/>;
			}
			
			set
			{
				_<xsl:value-of select="Name"/> = value;
			}
		}
		</xsl:for-each>		
		
		<xsl:for-each select="ClassAttribs/ClassAttributes[CType='array']">
		
		public virtual Iesi.Collections.Generic.ISet&lt;<xsl:value-of select="Type"/>&gt;<xsl:text> </xsl:text><xsl:value-of select="PropertyName"/>
		{
			get
			{
				return _<xsl:value-of select="Name"/>;
			}
			
			set
			{
				_<xsl:value-of select="Name"/> = value;
			}
		}		
		</xsl:for-each>
		
		#endregion
		
		<![CDATA[///<summary>]]>
		/// Use business rules to specify what a unique record looks like
		/// default uses all single field .ToString() values
		<![CDATA[///</summary>]]>
		public override int GetHashCode ( )
		{
		    return ( GetType ( ).Name<xsl:for-each select="ClassAttribs/ClassAttributes[CType='single']"> 
			+ "|" + ( <xsl:value-of select="PropertyName"/> == null ? "" : <xsl:value-of select="PropertyName"/>.ToString ( ) ) </xsl:for-each> ).GetHashCode ( );
		}
	
	}
	
}
	
	</xsl:template>
	
	
	
</xsl:stylesheet>